<template>
    <div class="area">
        <div class="area1" v-if="utype==0">
        <el-row class="tac">
                <el-menu
                default-active="2"
                class="el-menu-vertical-demo"
                router
                background-color="#304156"
                text-color="#bfcbd9"
                active-text-color="#409EFF"
                >
                <el-menu-item index="/home/mygoods" >
                    <i class="el-icon-setting"></i>
                    <span slot="title">我的商品</span>
                </el-menu-item>
                <el-menu-item index="/home/publish">
                    <i class="el-icon-setting"></i>
                    <span slot="title">发布商品</span>
                </el-menu-item>
                <el-menu-item index="/home/category">
                    <i class="el-icon-setting"></i>
                    <span slot="title">商品分类管理</span>
                </el-menu-item>
                <el-menu-item index="/home/myorder" >
                    <i class="el-icon-setting"></i>
                    <span slot="title">我的订单</span>
                </el-menu-item>
                <el-menu-item index="/home/clientsinfo" >
                    <i class="el-icon-setting"></i>
                    <span slot="title">查询所有客户</span>
                </el-menu-item>
                <el-submenu index="/home/personal">
                    <template slot="title">
                    <i class="el-icon-location"></i>
                    <span>个人中心</span>
                </template>
                <el-menu-item-group>
                    <el-menu-item index="/home/personal/message">查看个人信息</el-menu-item>
                    <el-menu-item index="/home/personal/updatapwd">修改密码</el-menu-item>
                    </el-menu-item-group>
                </el-submenu>
                </el-menu>
            
        </el-row>
        </div>
        <div class="area1" v-else>
        <el-row class="tac">
                <el-menu
                default-active="2"
                class="el-menu-vertical-demo"
                router
                background-color="#304156"
                text-color="#bfcbd9"
                active-text-color="#409EFF"
                >
                <el-menu-item index="/home/historyOrder" >
                    <i class="el-icon-setting"></i>
                    <span slot="title">查看历史订单</span>
                </el-menu-item>
                  <el-menu-item index="/home/shopcart" >
                  <i class="el-icon-shopping-cart-2"></i>
                  <span slot="title">购物车</span>
                </el-menu-item>
                  <el-menu-item index="/home/favorites" >
                    <i class="el-icon-star-off"></i>
                    <span slot="title">收藏夹</span>
                  </el-menu-item>
                <el-submenu index="/home/personal">
                    <template slot="title">
                    <i class="el-icon-location"></i>
                    <span>个人中心</span>
                </template>
                <el-menu-item-group>
                    <el-menu-item index="/home/personal/message">查看个人信息</el-menu-item>
                    <el-menu-item index="/home/personal/updatames">修改个人信息</el-menu-item>
                    <el-menu-item index="/home/personal/updatapwd">修改密码</el-menu-item>
                    </el-menu-item-group>
                </el-submenu>
                </el-menu>
            
        </el-row>
        </div>            
        <div class="area2">
            <router-view></router-view>
        </div>
    </div>
</template>
<script>
export default {
    inject:['reload'],
    name:'Home',
    data(){
        return{
            uid:this.$store.state.uid,
            utype:''
        }
    },
    methods:{
        getUserType(){
            this.$axios.get('/api/selectUserByUid',{
              params:{
                  uid:this.uid
              }}).then(res =>{
                this.utype=res.data.data.utype
              }).catch(error =>{
               // console.log('提交失败')
                console.log(error )
              })
        },
        
    },
    computed:{
    },
    mounted(){
        this.getUserType()
    }
}
</script>
<style lang="less" scoped>
    .area{
        display: flex;
        height: 1000px;
        .area1{
            width:210px; 
            min-height: calc(~"(100% - 50px)");
            border: 1px solid;
            background-color: #304156;
        }
        .area2{
            width: calc(100% - 210px);
            
        }

        .area3{
            font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
            font-size: 15px;
        }
    }
</style>


